package graphics;

import hardware.Display2D;

public class Sprite2D {

public int xPos;
public int yPos;
protected int animationCounter;
		
protected boolean visible;
protected short color;	

public Sprite2D()
{
	visible=false;
	xPos=0;
	yPos=0;
}




public void setPos(int newXPos,int newYPos)
{
	xPos=newXPos;
	yPos=newYPos;

}



public void movie(int xVector,int yVector,int zVector)
{
	xPos+=xVector;
	yPos+=yVector;
}


/**
 * @author Tavin
 * 
 * Date 1.4.2011
 * 
 * @param status new status
 */

public void setVisible(boolean status)
{
	visible=status; 
}


/**
 * @author Tavin
 * 
 * Date 1.4.2011
 * 
 * returns actual visibility
 * 
 * @return actual visibility
 */

public boolean isVisible()
{
	return(visible); 
}


/**
 * @author Tavin
 * 
 * Date 1.4.2011
 * 
 * Draw a sprite
 */

public void draw()
{
	if (!visible)
		return;
	
	Display2D.setPixel((byte)xPos,(byte) yPos, color);
	
}




/**
 * @author Tavin
 * 
 * Date 1.4.2011
 * 
 * Check for position match
 * 
 * @param xPos x position to check
 * @param yPos y position to check
 * @return
 */
	
public boolean checkPosition(int xPos, int yPos)
{
	if (!visible)
		return(false);
	
	if ((this.xPos==xPos) & (this.yPos==yPos))
	return(true);
	
return(false);	
}
	

public void mirrorX()
{
	xPos=(xPos*(-1))+7;
}

public void mirrorY()
{
	yPos=(yPos*(-1))+7;
}




public boolean match(int xPos,int yPos)
{
	if ((this.xPos==xPos) && (this.yPos==yPos))
		return(true);
	
		return(false);
}

}

